/**
 * Created by Baggio on 2018-10-16.
 */
$(function () {
    $("#prizesAdd").click(function () {
        $("#form-prizes-add").ajaxSubmit({
            type: "POST",
            url: '/prizes/modifyPrizes.html',
            data: $('#form-prizes-add').serialize(),// 你的formid
            dataType: "json",
            error: function (request) {
                alert("Connection error");
            },
            beforeSend: function () {
                console.log("begin...............");
                $(".loading").show();
            },
            success: function (data) {

                console.log(data);
                if (data.code != 0) {
                    layer.msg('操作成功!', {icon: 6, time: 1000}, function () {
                        console.log(data);
                        window.parent.location.reload();
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    })
                }

            },
            complete: function (XMLHttpRequest, textStatus) {
                // alert('远程调用成功，状态文本值：'+textStatus);
                console.log("end...............");
                $(".loading").hide();
            },
        });
    })
});
